package homework;

import java.util.*;

public class Map1 {
    public static void main(String[] args) {

        Map map = new HashMap();
        HashSet hashSet = new HashSet();
        List list = Arrays.asList("a", "b", "a", "b", "c", "a", "b", "c", "b");
        hashSet.addAll(list);

        for (Object item : hashSet) {
            int count = 0;
            for (int i = 0; i < list.size(); i++) {
                if (item.equals(list.get(i))) {
                    count++;
                }
                map.put(item, count);
            }
        }

        Set set = map.keySet();
        for (Object key : set) {
            System.out.println(key + ":" + map.get(key));
        }
    }
}
